<template>
    <div class="detail">
        <div class="titleBox">
            <div class="title">
                <div class="avatar">
                    <img :src="gameConfig.thumbnail" alt="">
                </div>
                <div class="gameMsg">
                    <div>
                        {{ gameConfig.title }}
                    </div>
                    <span class="strategy">
                        {{ gameConfig.strategy }}
                    </span>
                    <div class="star">
                        <img src="@/assets/img/star.svg" alt="" v-for="(item,index) in Math.ceil(gameConfig.score)">
                    </div>
                </div>
                <div class="score">
                    {{ gameConfig.score }}
                </div>
            </div>
            <div class="playNow">
                PlayNow
            </div>
        </div>
        <GameList :gameData="gameList"></GameList>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { getDetailMsg, getDetaiScreen, gameGroup } from '@/apis/home.ts'

import GameList from '@/components/gameList.vue'
const route = useRoute()

const gameList = ref<any>([])
const gameConfig = ref<any>({
    score:0
})
const screenData = ref<any>([])
onMounted(() => {
    getData()
})

const getData = async () => {
    let res = await getDetailMsg({ id: route.params.id })
    gameConfig.value = res.data.data
    let response = await getDetaiScreen({ id: route.params.id })
    screenData.value = res.data.data
    let ress = await gameGroup({ groupId: 0 })
    gameList.value = ress.data.data[0].game_list
}

</script>

<style lang="scss">
.detail {
    // width: calc(100vw - 50px);
    background-color: $bg-color3;
    padding-top: 20px;
    .titleBox {
        padding: 16px;
        margin: 0 20px;
        background-color: #004d8a;
        margin-bottom: 5px;
        border-radius: 6px;
        .title {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            color: #fff;
            font-weight: 600;
            font-size: 14px;
            .avatar{
                    img {
                    width: 100px;
                    height: 100px;
                    border-radius: 6px;
                }
                }
                .gameMsg {
                    height: 100px;
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                    font-size: 20px;
                    .strategy {
                        display: inline-block;
                        min-width: 60px;
                        border-radius: 6px;
                        padding: 6px 10px;
                        background: #ffc46e;
                        color: #3f3e3c;
                    }
                }
        }



    }

    .playNow {
        margin-top: 20px;
        background: linear-gradient(106deg, #ffb200, #ff7e00);
        border: 0;
        border-radius: 4px;
        color: #fff;
        padding: 8px 2%;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }
}
</style>